package com.lituoxy.dialer.updata;
import org.json.JSONObject;

import java.io.InputStream;

public class UpdataInfoParser {
	public static UpdataInfo getUpdataInfo(InputStream is) throws Exception {
		JSONObject jsonObject = HttpHelper.convertStringToJason(HttpHelper.convertStreamToString(is));
		UpdataInfo info = new UpdataInfo();
		info.setProductName(jsonObject.getString("prod"));
		info.setVersion(jsonObject.getString("ver"));
		info.setDownloadUrl(jsonObject.getString("download"));
		info.setLastUptime(jsonObject.getString("lastUptime"));
		info.setBy(jsonObject.getString("by"));
		info.setPendingVer(jsonObject.getString("pendingVer"));
		return info;
	}
}
